@tool
class_name ControllerCommand_AddBuff
extends ControllerCommand

## 释放技能

#region 属性
@export var buff_id:String
@export var level:int = 1
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
#endregion
#region 公共方法
func activate(controller:ControllerComponent,command_dict_by_tag:Dictionary) -> bool:
	if not super(controller,command_dict_by_tag):
		return false
	var target = controller.entity as Entity
	var buff_component:BuffComponent = target.get_component(BuffComponent)
	if buff_component:
		buff_component.add_buff_by_id(target,buff_id,level)
	return true
func deactivate(controller:ControllerComponent,command_dict_by_tag:Dictionary):
	var target = controller.entity as Entity
	var buff_component:BuffComponent = target.get_component(BuffComponent)
	if buff_component:
		buff_component.remove_buff_by_id(buff_id)
	super(controller,command_dict_by_tag)
#endregion
#region 私有方法
#endregion
#region 生命周期函数
func _init() -> void:
	if Engine.is_editor_hint():
		resource_local_to_scene = true
#endregion
